﻿<Page x:Class="DTC.Pages.MedRecordsListPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Res="clr-namespace:DTC.Resources"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        Title="MedRecordsListPage" MaxHeight="850" MaxWidth="1150"
	    SnapsToDevicePixels="True">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/Brushes.xaml"/>
                <ResourceDictionary Source="../Resources/ListBoxStyles.xaml"/>
                <ResourceDictionary Source="../Resources/TextEditStyles.xaml"/>
                <ResourceDictionary Source="../Resources/ButtonsStyles.xaml"/>
				<ResourceDictionary Source="../Resources/TextBlockStyles.xaml"/>
                <ResourceDictionary Source="../Resources/BorderStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <Border x:Key="SearchToolTipText" Padding="5">
                <StackPanel>
                    <TextBlock>
                        В строке поиска вы можете указать следующую информацию
                        <LineBreak/>
                        об искомом пациенте:
                        <LineBreak/>
                    </TextBlock>
                    <TextBlock Margin="20,0,0,0"
                               FontStyle="Italic">
                        Номер карточки
                        <LineBreak/>
                        Фамилия
                        <LineBreak/>
                        Имя
                        <LineBreak/>
                        Отчество
                        <LineBreak/>
                        Код заболевания
                        <LineBreak/>
                        Заболевание
                        <LineBreak/>
                    </TextBlock>
                    <TextBlock>
                        Параметры поиска могут быть указанны в любом сочетании и порядке.
                    </TextBlock>
                </StackPanel>
            </Border>
        </ResourceDictionary>
    </Page.Resources>
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="110"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid VerticalAlignment="Stretch"
					HorizontalAlignment="Stretch">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="200"/>
						<ColumnDefinition Width="*"/>
					</Grid.ColumnDefinitions>
			<Border BorderBrush="{StaticResource GrouperBorderBrush}"
					BorderThickness="1"
					CornerRadius="3"
					Padding="10,0,10,10"
					Margin="15,0,0,15">
            	<StackPanel VerticalAlignment="Center">
                	<TextBlock Foreground="{StaticResource MarkingFontColor}"
                       			Text="Группировaть:"/>
                	<RadioButton Name="DoctorGroupCheckBox"
                         		Margin="10,5,0,0"
                         		Click="DoctorGroupCheckBox_Click">По лечащаму врачу</RadioButton>
                	<RadioButton Name="DiseaseGroupRadioButton"
                         		Margin="10,5,0,0"
                         		Click="DiseaseGroupRadioButton_Click">По заболеванию</RadioButton>
                	<RadioButton Name="NoGoupingRadioButton"
                         		Margin="10,5,0,0"
                         		Click="NoGoupingRadioButton_Click">Не группировать</RadioButton>
            	</StackPanel>
			</Border>
			<Border BorderThickness="1"
					BorderBrush="{StaticResource GrouperBorderBrush}"
					CornerRadius="3"
					Margin="30,0,15,15"
					VerticalAlignment="Center"
					HorizontalAlignment="Stretch"
					Grid.Column="1"
					SnapsToDevicePixels="True">
            		<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
                		<TextBlock Foreground="{StaticResource MarkingFontColor}"
                           				VerticalAlignment="Center"
										HorizontalAlignment="Center"
                       					Text="Поиск медкарт"
										FontSize="12"
										FontWeight="Bold"/>
						<WrapPanel VerticalAlignment="Top"
									Margin="0,10,0,25">
                            <AdornerDecorator>
                                <TextBox Name="SearchStringTextBox" 
                                         Width="400" 
                                         Margin="15,0,0,0"
                                         FontSize="12"
                                         VerticalAlignment="Center"
                                         Height="21"
                                         Style="{StaticResource SearchTextBoxStyle}"
                                         ToolTip="{StaticResource SearchToolTipText}">
                                        <Res:WatermarkService.Watermark>
                                            <TextBlock Text="Строка поиска"
                                                       FontStyle="Italic"
                                                       FontFamily="Arial"
                                                       FontSize="12"
                                                       Foreground="Black"
                                                       VerticalAlignment="Center"/>
                                        </Res:WatermarkService.Watermark>
                            </TextBox>
                        </AdornerDecorator>

                        <Button Name="SearchButton" 
                    				VerticalAlignment="Bottom"
                    				Margin="35,0,0,0"
                    				BorderThickness="1"
                    				SnapsToDevicePixels="True"
                    				Style="{StaticResource SearchButton}"
                    				Height="30"
                    				Width="110"
                    				Click="SearchButton_Click">Искать</Button>
						</WrapPanel>
					</StackPanel>
			</Border>
        </Grid>
        <Grid Grid.Row="1" Margin="15,0,15,20">
            <ListBox Name="MedRecListBox" 
                 VerticalContentAlignment="Stretch" 
                 HorizontalContentAlignment="Stretch"
                 ItemContainerStyle="{StaticResource ColorListBoxItem}" Background="#FFC9CDFB">
                <ListBox.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.HeaderTemplate>
                            <DataTemplate>
                                <Border VerticalAlignment="Top" Height="40">
                                        <TextBlock Text="{Binding Name}"
                                               Grid.Column="1" Grid.Row="1"
                                               VerticalAlignment="Center"
                                               HorizontalAlignment="Center"
											   Foreground="#FF2C2C2C"
											   FontSize="14"
                                               FontWeight="Bold"/>
                                </Border>
                            </DataTemplate>
                        </GroupStyle.HeaderTemplate>
                    </GroupStyle>
                </ListBox.GroupStyle>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid Margin="10,0,0,0" Height="70" VerticalAlignment="Center">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="0.2*" MaxWidth="150"/>
                                <ColumnDefinition Width="0.3*"/>
                                <ColumnDefinition Width="0.1*" MaxWidth="100"/>
                                <ColumnDefinition Width="0.4*"/>
								<ColumnDefinition Width="30"/>
								<ColumnDefinition Width="15"/>
                            </Grid.ColumnDefinitions>
							<Border BorderBrush="{StaticResource ListBoxItemBorderBrush}" 
									BorderThickness="1" CornerRadius="3"
									Grid.Column="0" 
									Margin="6">
							<StackPanel Grid.Column="0"
										Margin="4,0,4,0"
                                   			HorizontalAlignment="Center"
                                   			VerticalAlignment="Center">
								<TextBlock Text="Номер карточки:"
											Foreground="Gray"
											FontSize="10"
											HorizontalAlignment="Center"
											VerticalAlignment="Center"/>
                            	<TextBlock Text="{Binding PatientNumber}"
											HorizontalAlignment="Center"
											VerticalAlignment="Center"
											FontSize="14"/>
							</StackPanel>
							</Border>
							<Border BorderBrush="{StaticResource ListBoxItemBorderBrush}" 
									BorderThickness="1" CornerRadius="3"
									Grid.Column="1" 
									Margin="6">
								<StackPanel Grid.Column="1"
											Margin="4,0,4,0"
	                                   			HorizontalAlignment="Center"
	                                   			VerticalAlignment="Center">
								<TextBlock Text="Ф.И.О пациента:"
											Foreground="Gray"
											FontSize="10"
											HorizontalAlignment="Center"
											VerticalAlignment="Center"/>
                            	<TextBlock Text="{Binding FullName}"
                                   			HorizontalAlignment="Center"
                            	       		VerticalAlignment="Center"/>
							</StackPanel>
							</Border>
							<Border BorderBrush="{StaticResource ListBoxItemBorderBrush}" 
									BorderThickness="1" CornerRadius="3"
									Grid.Column="2" 
									Margin="6">
							<StackPanel Grid.Column="2"
										Margin="4,0,4,0"
	                                   	HorizontalAlignment="Center"
	                                   	VerticalAlignment="Center">
										<TextBlock Text="Код заболевания:"
											Foreground="Gray"
											FontSize="10"
											HorizontalAlignment="Center"
											VerticalAlignment="Center"/>
                            	<TextBlock Text="{Binding DTCDisease.Code}"
                                   			HorizontalAlignment="Center"
                                   			VerticalAlignment="Center"/>
							</StackPanel>
							</Border>
							<Border BorderBrush="{StaticResource ListBoxItemBorderBrush}" 
									BorderThickness="1" CornerRadius="3"
									Grid.Column="3" 
									Margin="6">
								<StackPanel 
										Margin="4,0,4,0"
	                                   	HorizontalAlignment="Center"
	                                   	VerticalAlignment="Center">
								<TextBlock Text="Лечащий врач:"
											Foreground="Gray"
											FontSize="10"
											HorizontalAlignment="Center"
											VerticalAlignment="Center"/>
                            	<TextBlock Margin="5,0,0,0" Text="{Binding DTCDoctor.FullName}"
                                   Grid.Column="3"
                                   HorizontalAlignment="Left"
                                   VerticalAlignment="Center"/>
								</StackPanel>
							</Border>
							<Border BorderBrush="{x:Null}" 
									BorderThickness="1" CornerRadius="3"
									Grid.Column="4" 
									Margin="2,6,6,6">
								<StackPanel 
										Margin="2,0,2,0"
	                                   	HorizontalAlignment="Center"
	                                   	VerticalAlignment="Center">
									<Button Name="ViewDrugPrescs"
											Style="{StaticResource ListBoxInlineButton}"
											Height="15"
											Width="15"
											Margin="0,0,0,5"
                                            Click="ViewDrugPrescs_Click">
											<Button.ToolTip>
												Просмотр назначений препаратов
											</Button.ToolTip>
									</Button>
									<Button Name="ViewVisits"
											Style="{StaticResource ListBoxInlineButton}"
											Height="15"
											Width="15"
											Margin="0,5,0,0"
                                            Click="ViewVisits_Click">
											<Button.ToolTip>
												Просмотр истории посещений врачей
											</Button.ToolTip>
									</Button>
								</StackPanel>
							</Border>
							<Grid Grid.Column="5">
									<Grid.RowDefinitions>
										<RowDefinition Height="0.5*"/>
										<RowDefinition Height="0.5*"/>
									</Grid.RowDefinitions>
                                <Button Name="DeleteBoxButton"
									Grid.Row="1"
									Height="32"
									Width="10"
									Margin="2,0,0,0"
									Style="{StaticResource DelRecButton}"
									HorizontalAlignment="Right"
									VerticalAlignment="Bottom"
                                        Click="DelRecord_Click"
                                    Tag="{Binding}">
                                    <Button.ToolTip>
                                        <ToolTip Style="{StaticResource DefaultToolTipStyle}"
												Height="33"
												Width="75"
												VerticalOffset="-27">
                                            <TextBlock Text="Удалить"/>
                                        </ToolTip>
                                    </Button.ToolTip>
                                </Button>
                                <Button Name="ViewBoxButton"
									Grid.Row="0"
									Height="32"
									Width="10"
									Margin="2,0,0,0"
									Style="{StaticResource ViewRecButton}"
									HorizontalAlignment="Right"
									VerticalAlignment="Top"
                                        Click="ViewRecord_Click"
                                    Tag="{Binding}">
                                    <Button.ToolTip>
                                        <ToolTip Style="{StaticResource DefaultToolTipStyle}"
												Height="33"
												Width="75"
												VerticalOffset="-27">
                                            <TextBlock Text="Изменить"/>
                                        </ToolTip>
                                    </Button.ToolTip>
                                </Button>
								</Grid>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
			<Border Name="RecorsListBoxControlPanel"
						Margin="1,1,0,0"
						HorizontalAlignment="Left"
						Width="35" 
						Style="{StaticResource ListBoxControlPanel}"
						CornerRadius="6,0,0,6" BorderThickness="0,0,1,0">
						<StackPanel>
							<Button Name="AddRecord"
                        			Height="25" Width="25"
									Margin="0,5,0,0"
                        			Style="{StaticResource AddRecButton}"
                        			VerticalAlignment="Top"
                        			HorizontalAlignment="Center"
								 	Click="AddRecord_Click"
                                    ToolTip="Добавить новую карточку"/>
						</StackPanel>
				</Border>
        </Grid>
    </Grid>
</Page>
